<template>
    <view class="physique-detail">
        <!-- <image src="../../../static/img/home/test-bg.png" mode=""></image> -->
        <view
            v-if="imgUrl()"
            class="search_top_back"
            :style="{ backgroundImage: 'url(' + imgUrl() + 'test-bg.png' + ')' }"
        >
            <home-header title="测评结果" :result="evaluationResult"></home-header>
        </view>
        <view class="result-main">
            <view class="result-title"><text></text>解决方案：</view>
            <view class="result-content">
                <rich-text :nodes="decodeURIComponent(daily)" v-if="daily"></rich-text>
            </view>
            <View class="lines"></View>
            <view class="result-content">
                <rich-text :nodes="decodeURIComponent(advice)" v-if="advice"></rich-text>
            </view>
        </view>
        <view class="footer">
            <view class="footer-item" @click="back">重新测评</view>
        </view>
    </view>
</template>

<script>
export default {
    data() {
        return {
            evaluationResult: "",
            solution: "",
            id: "",
            advice: "",
            daily: "",
        };
    },
    onLoad(options) {
        this.evaluationResult = options.evaluationResult = "其他"
            ? options.evaluationResult
            : options.evaluationResult.slice(0, 1);

        // this.evaluationResult=options.evaluationResult.slice(0,1)
        // this.solution = options.solution.replace(/%/g, "%25");
        // var obj = JSON.parse(options.solution);
        const obj = JSON.parse(options.solution.replace(/\n/g, "").replace(/\r/g, ""));
        this.advice = obj.advice.replace(/\<p/gi, '<p style="color: #333333;line-height: 20px;font-size:14px;"');
        this.daily = obj.daily.replace(/\<p/gi, '<p style="color: #333333;line-height: 20px;font-size:14px;"');
        console.log(obj, 12312313);
        // this.advice = JSON.parse(options.solution).advice;
        // this.daily = JSON.parse(options.solution).daily;
        this.id = options.id;

        console.log(this.solution, "数据内容", this.daily, this.advice);
    },
    methods: {
        back() {
            uni.redirectTo({
                url: "/packageHome/pages/physique/physique?id=" + this.id,
            });
        },
        imgUrl() {
            return this.request.appImageBaseUrl;
        },
    },
};
</script>

<style lang="scss">
body,
.physique-detail {
    height: 100%;
    min-height: 100%;
    background-position: center;
}
uni-page-body,
html {
    height: 100%;
}
.lines {
    width: 100%;
    height: 1px;
    background: #f7f7f7;
}
.search_top_back {
    background-size: 100%;
    width: 100%;
    background-repeat: no-repeat;
    z-index: 100;
    height: 548rpx;
}
</style>
